﻿@using NewRen.Models;
@using NewRen.Models.ViewModel;
@model NewRen.Models.ViewModel.vPwdEdit

@{
    vPwdEdit user = ViewBag.user as vPwdEdit;
    Layout = "~/Views/Shared/_Layout_Show.cshtml";
    ViewBag.Title = "牛人修改-密码修改";
}
<script>
    function PwdEditCheck() {
        if (!CheckPassword()) return false;
    }
    function CheckPassword() {
        if ($("#PasswordNew").val() != "") {
            if ($("#PasswordNew").val().length < 4) {
                CastMsg("至少输入4位密码");
                return false;
            }
        }
        if ($('#PasswordNew').val() != $('#NewPassword').val()) {
            CastMsg("两次输入密码不一致");
            $("#ConfirmInfo").css("color:red");
            return false;
        }

        return true;
    }
</script>
<div class="ucenter-left account-left-border">
    <div class="ucneter-l-head cf">
        <div class="ulhead-headicon">
            @if (user.Picture == null)
            {
                <img src="/Images/userphoto.png" width="50" height="50"
                     alt=@user.UserName style="border-radius:50%;" />
            }
            else
            {
                <img src="/User/ShowPicture/@user.ID" width="50"
                     alt=@user.UserName height="50" style="border-radius:50%;" />
            }

        </div>
        <div class="ulhead-info">
            <p class="ulhead-info-uname">@user.UserName</p>

            <div class="ulhead-info-tool">
                <a class="ulhead-icon icon-lock ucenter-mail " href="/User/PwdEdit/@user.ID" title="修改密码">
                    <div class="ucenter-mail-tip">修改密码</div>
                </a>
                <a href="/User/Edit/@user.ID"
                   class="ulhead-icon icon-setting ucenter-mail" title="设置个人信息"></a>
            </div>
        </div>
    </div>
    <div class="ucenter-l-list">
        <ul class="ullist-ul">
            <li id="uclick">
                <a href="/User/Show/@user.ID">个人中心</a>
            </li>
            <li id="uclick2">
                <a href="/User/DescriptionShow/@user.ID">个人概述</a>
            </li>
            <li id="uclick3" class="active">
                <a href="/User/Edit/@user.ID">账号设置</a>
            </li>
            <li id="uclick4">
                <a href="/User/IntegrationShow/@user.ID">收支明细</a>
            </li>
            <li id="uclick5">
                <a href="/User/CollectManager/@user.ID">我的收藏</a>
            </li>
            <li id="uclick6">
                <a href="/User/BrowseRecord/@user.ID">浏览记录</a>
            </li>
            <!--<li id="uclick7">
                <a href="/User/PayMoney/@user.ID">充值</a>
            </li>-->
        </ul>
    </div>
</div>
<div class="ucenter-right cf">
    <div class="ucenter-right-head">
        <span class="ucenter-right-head-show"><a href="/User/Edit/@user.ID">信息修改</a></span>
        <span class="ucenter-right-head-selected"><a href="/User/PwdEdit/@user.ID">密码修改</a></span>
        <span class="ucenter-right-head-show"><a href="/User/PictureEdit/@user.ID">更换头像</a></span>
    </div>
    <div class="tabGroup">
        @using (Html.BeginForm("PwdEdit", "User", FormMethod.Post, new
        {
            onsubmit = "return PwdEditCheck();"
        }))
        {
            @Html.AntiForgeryToken()
            <div class="form-item">
                <div class="item-label">
                    <label>用户名：</label>
                </div>
                <div class="item-span">
                    <span class="defInfo">@user.UserName</span>
                    @Html.HiddenFor(model => model.UserName, new
               {
                   @value = user.UserName
               })
                </div>
            </div>
            <div class="form-item">
                <div class="item-label">
                    <label>原始密码：</label>
                </div>
                <div class="item-span">
                    @Html.PasswordFor(model => model.Password, new
               {
                   @class = "txt sm"
               })
                </div>
            </div>
            <div class="form-item">
                <div class="item-label">
                    <label>新密码：</label>
                </div>
                <div class="item-span">
                    @Html.PasswordFor(model => model.PasswordNew, new
               {
                   @class = "txt sm"
               })
                </div>
            </div>
            <div class="form-item">
                <div class="item-label">
                    <label>确认密码：</label>
                </div>
                <div class="item-span">
                    @Html.Password("NewPassword","",new
               {
                   @class = "txt sm"
               })
                </div>
            </div>
            <div class="form-item">
                <div class="item-span">
                    <input type="submit" value="保存" class="btn">
                </div>
            </div>
        }
    </div>
</div>